package com.cmcc.shared.config

import android.content.Context
import android.content.pm.ApplicationInfo

object BaseConfig {

    private var IS_DEBUG_MODE: Boolean? = null

    val isDebug: Boolean
        get() = IS_DEBUG_MODE != null && IS_DEBUG_MODE!!

    /**
     * Sync lib debug with app's debug value. Should be called in module Application
     *
     * @param context
     */
    fun syncIsDebug(context: Context) {
        if (IS_DEBUG_MODE == null) {
            IS_DEBUG_MODE = context.applicationInfo != null && context.applicationInfo.flags and ApplicationInfo.FLAG_DEBUGGABLE != 0
        }
    }

}